package thread.test1BaseThread.notify;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by majian8 on 2019/6/3.
 */
public class ProducerConsumerClient {
    public static void main(String[] args) {
        Object lock=new Object();
        List list=new ArrayList<>();
        Producer producer=new Producer(lock, list);
        Consumer consumer=new Consumer(lock, list);
        for(int i=0;i<10;i++){
            new Thread(producer).start();
            new Thread(consumer).start();
        }

        try {
            Thread.sleep(1000*100);
            /*if(Thread.activeCount()>1){
                Thread.yield();
            }*/
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
